from rest_framework import serializers
from .models import *
class OrderInfoSer(serializers.ModelSerializer):
    status_name = serializers.SerializerMethodField(read_only=True)
    def get_status_name(self,obj):
        return obj.get_status_display()
    user_name = serializers.SerializerMethodField(read_only=True)
    def get_user_name(self,obj):
        return obj.user.username
    class Meta:
        model = OrderInfo
        fields = "__all__"
        read_only_fields = ['order_id',]

class OrderGoodsSer(serializers.ModelSerializer):

    class Meta:
        model = OrderGoods
        fields = '__all__'